package cn.com.darly.videoandroidpm.common;

import cn.com.darly.videoandroidpm.common.dao.ConversationMessageInfo;

/**
 * @author Darly/张宇辉/2018/5/8 16:51
 * @version 1.0/cn.com.darly.videoandroidpm.common
 */
public class StaticListener {
    //第一组静态接口，通知栏，展示到会话列表界面接口
    private static OnMessageChangeListener onChangeListener;

    public static void setOnMessageChangeListener(OnMessageChangeListener onMessageChangeListener) {
        onChangeListener = onMessageChangeListener;
    }

    public interface OnMessageChangeListener {
        boolean messageChange(ConversationMessageInfo info );

    }

    public static boolean messageChange(ConversationMessageInfo info ) {
        if (onChangeListener!=null) {
            return   onChangeListener.messageChange(info);
        }else {
            return false;
        }
    }
    //第二组静态接口，刷新添加好友完成后，页面功能
    private static OnRefreshFriendListener onRefreshListener;

    public static void setOnRefreshFriendListener(OnRefreshFriendListener onRefreshFriendListener) {
        onRefreshListener = onRefreshFriendListener;
    }

    public interface OnRefreshFriendListener {
        void refreshFriend();
    }


    public static void refreshFriend() {
        if (onRefreshListener!=null)onRefreshListener.refreshFriend();
    }

    //第三组静态接口，用戶接通視頻后，進行頁面整理
    private static OnConnectVideoListener onConnectVideoListener;

    public static void setOnConnectVideoListener(OnConnectVideoListener onConnectVideoListener) {
        StaticListener.onConnectVideoListener = onConnectVideoListener;
    }

    public interface OnConnectVideoListener {
        void connect(String key,String rtmp);
    }


    public static void connectVideo(String key,String rtmp) {
        if (onConnectVideoListener!=null)onConnectVideoListener.connect(key,rtmp);
    }


    //第四组静态接口，用户开启呼叫后直接挂断，对方展示呼叫页面需要关闭。
    private static OnCallConsoleListener onCallConsoleListener;

    public static void setOnCallConsoleListener(OnCallConsoleListener callConsoleListener) {
        onCallConsoleListener = callConsoleListener;
    }

    public interface OnCallConsoleListener {
        void callConsole(String key);
    }


    public static void callConsoled(String key) {
        if (onCallConsoleListener!=null)onCallConsoleListener.callConsole(key);
    }
}
